from enetity_extraction.company_data_test import get_data
# from enetity_extraction.test_docx import get_docx_extraction_result
from logic_rule.case_code_check import check_case_code, create_type_codes
from logic_rule.court_code_check import is_valid_court_code, create_global_set
from logic_rule.money_check import check_money
from logic_rule.serial_number_check import is_valid_serial_number
from logic_rule.signature_check import check_signature
from logic_rule.trial_date_check import chinese_date_to_datetime


def rj_rule_check(sentences_extract):
    # test_data = get_data()
    # extract_result = get_docx_extraction_result()
    # sentences_extract = extract_result[1]

    result_list = []
    # 正文序号
    result = is_valid_serial_number(sentences_extract)
    if result!=None:
        result_list.append(result)

    # 审判日期
    result = chinese_date_to_datetime(sentences_extract)
    if result != None:
        result_list.append(result)

    # 法院代字
    court_codes = create_global_set()
    result = is_valid_court_code(court_codes, sentences_extract)
    if result != None:
        result_list.append(result)

    # 尾部落款，龙林涛在做，因此废弃
    # result = check_signature(sentences_extract)
    # if result != None:
    #     result_list.append(result)

    # 案号
    type_codes = create_type_codes()
    result = check_case_code(court_codes, type_codes, sentences_extract)
    if result != None:
        result_list.append(result)

    # 金额前面不应该加人民币
    result = check_money(sentences_extract)
    if result != None:
        result_list.append(result)

    return result_list


if __name__ == "__main__":
    # test_data = get_data()
    # extract_result = get_docx_extraction_result()
    # sentences_extract = extract_result[1]
    # result_list = rj_rule_check(sentences_extract)
    pass
